package vip.xiaonuo.supplier.modular.business.businessMain.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import vip.xiaonuo.common.pojo.CommonEntity;
import vip.xiaonuo.supplier.modular.base.carrier.entity.SupplierCarrier;
import vip.xiaonuo.supplier.modular.base.stores.entity.SupplierStores;
import vip.xiaonuo.supplier.modular.custom.objects.entity.SupplierObjects;
import vip.xiaonuo.supplier.modular.finance.account.entity.SupplierAccount;
import vip.xiaonuo.supplier.modular.finance.settlementproject.entity.SupplierSettlementProject;
import vip.xiaonuo.supplier.modular.purchase.suppliers.entity.SupplierSuppliers;
import vip.xiaonuo.supplier.modular.structure.user.entity.SupplierUser;
import vip.xiaonuo.supplier.modular.warehouse.storages.entity.SupplierStorages;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 业务主表实体
 *
 * @author Mr.wu
 * @date  2025/03/26 11:03
 **/
@Getter
@Setter
@TableName("SUPPLIER_BUSINESS_MAIN")
public class SupplierBusinessMain extends CommonEntity {

    /** 业务ID */
    @TableId
    @Schema(description = "业务ID")
    private String id;

    /** 业务类型 */
    @Schema(description = "业务类型")
    @Trans(type = TransType.DICTIONARY, key = "SUPPLIER_BUSINESS_TYPE")
    private String businessType;

    /** 业务单号 */
    @Schema(description = "业务单号")
    private String businessCode;

    /** 业务项目 */
    @Schema(description = "业务项目")
    @Trans(type = TransType.SIMPLE, target = SupplierSettlementProject.class, fields = {"projectName","projectCode"}, alias = "settlementProject", refs = {"businessProjectIdName","businessProjectIdCode"})
    private String businessProjectId;

    /**业务项目编码 */
    @Schema(description = "业务项目编码")
    @TableField(exist = false)
    private String businessProjectIdCode;

    /**业务项目名称 */
    @Schema(description = "业务项目名称")
    @TableField(exist = false)
    private String businessProjectIdName;

    /** 业务对象 */
    @Schema(description = "业务对象")
    @Trans(type = TransType.SIMPLE, target = SupplierObjects.class, fields = {"objectName","objectCode"}, alias = "objects", refs = {"businessObjectIdName","businessObjectCode"})
    private String businessObjectId;

     /**业务对象名称 */
    @Schema(description = "业务对象名称")
    @TableField(exist = false)
    private String businessObjectIdName;

    /**业务对象编码 */
    @Schema(description = "业务对象编码")
    @TableField(exist = false)
    private String businessObjectCode;

    /**业务对象名称 */
    @Schema(description = "业务对象名称")
    private String businessObjectName;

    /**业务对象地址 */
    @Schema(description = "业务对象地址")
    private String businessObjectAddress;

    /**业务对象电话 */
    @Schema(description = "业务对象电话")
    private String businessObjectTel;

    /**业务对象应收（付）结算前余额*/
    @Schema(description = "业务对象应收（付）结算前余额")
    private BigDecimal businessObjectPayableBefore;

    /**业务对象应收（付）结算后余额*/
    @Schema(description = "业务对象应收（付）结算后余额")
    private BigDecimal businessObjectPayableAfter;

    /** 经手人ID */
    @Schema(description = "经手人ID")
    @Trans(type = TransType.SIMPLE, target = SupplierUser.class, fields = "name", alias = "user", ref = "businessHandlerIdName")
    private String businessHandlerId;

     /**经手人ID名称 */
    @Schema(description = "经手人ID名称")
    @TableField(exist = false)
    private String businessHandlerIdName;

    /** 业务员ID */
    @Schema(description = "业务员ID")
    @Trans(type = TransType.SIMPLE, target = SupplierUser.class, fields = "name", alias = "user", ref = "businessSalesmanIdName")
    private String businessSalesmanId;

     /**业务员ID名称 */
    @Schema(description = "业务员ID名称")
    @TableField(exist = false)
    private String businessSalesmanIdName;

    /** 出货门店 */
    @Schema(description = "出货门店")
    @Trans(type = TransType.SIMPLE, target = SupplierStores.class, fields = "storeName", alias = "stores", ref = "businessShippingStoreIdName")
    private String businessShippingStoreId;

     /**出货门店名称 */
    @Schema(description = "出货门店名称")
    @TableField(exist = false)
    private String businessShippingStoreIdName;

    /** 出货仓库 */
    @Schema(description = "出货仓库")
    @Trans(type = TransType.SIMPLE, target = SupplierStorages.class, fields = "storeName", alias = "storages", ref = "businessShippingStorageIdName")
    private String businessShippingStorageId;

     /**出货仓库名称 */
    @Schema(description = "出货仓库名称")
    @TableField(exist = false)
    private String businessShippingStorageIdName;

    /** 入库门店 */
    @Schema(description = "入库门店")
    @Trans(type = TransType.SIMPLE, target = SupplierStores.class, fields = "storeName", alias = "stores", ref = "businessStorageStoreIdName")
    private String businessStorageStoreId;

     /**入库门店名称 */
    @Schema(description = "入库门店名称")
    @TableField(exist = false)
    private String businessStorageStoreIdName;

    /** 入库仓库 */
    @Schema(description = "入库仓库")
    @Trans(type = TransType.SIMPLE, target = SupplierStorages.class, fields = "storeName", alias = "storages", ref = "businessStorageStorageIdName")
    private String businessStorageStorageId;

     /**入库仓库名称 */
    @Schema(description = "入库仓库名称")
    @TableField(exist = false)
    private String businessStorageStorageIdName;

    /** 运单号 */
    @Schema(description = "运单号")
    private String businessWaybillNumber;

    /** 合计件数 */
    @Schema(description = "合计件数")
    private BigDecimal businessNumberProduction;

    /** 商品种类 */
    @Schema(description = "商品种类")
    private Integer businessNumberCategory;

    /** 包装方式 */
    @Schema(description = "包装方式")
    private String businessPackagingMethod;

    /** 承运人 */
    @Schema(description = "承运人")
    @Trans(type = TransType.SIMPLE, target = SupplierCarrier.class, fields = "carrierName", alias = "carrier", ref = "businessCarrierIdName")
    private String businessCarrierId;

     /**承运人名称 */
    @Schema(description = "承运人名称")
    @TableField(exist = false)
    private String businessCarrierIdName;

    /** 合计数量 */
    @Schema(description = "合计数量")
    private BigDecimal businessTotalNumber;

    /** 合计金额 */
    @Schema(description = "合计金额")
    private BigDecimal businessTotalAmount;

    /** 折让金额 */
    @Schema(description = "折让金额")
    private BigDecimal businessDiscountAmount;

    /** 应收金额 */
    @Schema(description = "应收金额")
    private BigDecimal businessReceivableAmount;

    /** 应付金额 */
    @Schema(description = "应付金额")
    private BigDecimal businessPayableAmount;

    /** 实收金额 */
    @Schema(description = "实收金额")
    private BigDecimal businessInAmount;

    /** 实付金额 */
    @Schema(description = "实付金额")
    private BigDecimal businessPayAmount;

    /** 收（付）款账户 */
    @Schema(description = "收（付）款账户")
    @Trans(type = TransType.SIMPLE, target = SupplierAccount.class, fields = "accountName", alias = "account", ref = "businessAccountIdName")
    private String businessAccountId;

    /**收（付）款账户 */
    @Schema(description = "收（付）款账户名称")
    @TableField(exist = false)
    private String businessAccountIdName;

    /** 待收金额 */
    @Schema(description = "待收金额")
    private BigDecimal businessPendingInAmount;

    /** 待付金额 */
    @Schema(description = "待付金额")
    private BigDecimal businessPendingPayAmount;

    /** 收付款期限 */
    @Schema(description = "收付款期限")
    private Date businessPaymentDeadline;

    /** 结算状态（0-未结算，1-已结算，2-部分结算） */
    @Schema(description = "结算状态（0-未结算，1-已结算，2-部分结算）")
    @Trans(type = TransType.DICTIONARY, key = "BUSINESS_PAYMENT_STATUS", ref="businessPaymentStatusName")
    private String businessPaymentStatus;

    /**结算状态名称 */
    @Schema(description = "结算状态名称")
    @TableField(exist = false)
    private String businessPaymentStatusName;

    /** 业务摘要*/
    @Schema(description = "业务摘要")
    private String businessAbstract;

    /** 整单备注 */
    @Schema(description = "整单备注")
    private String businessRemark;

    /**结算业务IDS */
    @Schema(description = "结算业务IDS")
    private String businessBusinessIds;

    /**业务结算类型(0-收款,1-付款，2-转账) */
    @Schema(description = "业务结算类型(0-收款,1-付款，2-转账)")
    private String businessSettlementType;

    /**账户结算前余额*/
    @Schema(description = "账户结算前余额")
    private BigDecimal businessAccountBalanceBefore;

    /**账户结算后余额*/
    @Schema(description = "账户结算后余额")
    private BigDecimal businessAccountBalanceAfter;

    /** 业务状态 */
    @Schema(description = "业务状态")
    @Trans(type = TransType.DICTIONARY, key = "BUSINESS_STATUS", ref="businessStatusName")
    private String businessStatus;

    /**业务状态名称 */
    @Schema(description = "业务状态名称")
    @TableField(exist = false)
    private String businessStatusName;

    /** 扩展信息 */
    @Schema(description = "扩展信息")
    private String extJson;

    /** 数据归属 */
    @Schema(description = "数据归属")
    private String companyId;
}
